package com.kingtroldata.monitorview_demo;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.EditText;

/**
 * Created by user on 2017/2/21.
 */

public class SettingActivity extends AppCompatActivity {

    private EditText factoryId;
    private EditText manageId;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_setting);

        factoryId = (EditText) findViewById(R.id.et_factoryId);
        manageId = (EditText) findViewById(R.id.et_manageId);

        String factoryId = PrefUtils.getString(this, "factoryId", "1151041276");
        String manageId = PrefUtils.getString(this, "manageId", "10");
        this.factoryId.setText(factoryId);
        this.manageId.setText(manageId);
    }

    public void ok(View view) {
        String factoryId = this.factoryId.getText().toString().trim();
        String manageId = this.manageId.getText().toString().trim();

        PrefUtils.putString(this, "factoryId", factoryId);
        PrefUtils.putString(this, "manageId", manageId);

        Intent intent = new Intent();
        intent.putExtra("factoryId", factoryId);
        intent.putExtra("manageId", manageId);
        setResult(0, intent);
        finish();
    }
}
